package com.quktzhuanka.app.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.quktzhuanka.app.R;
import com.quktzhuanka.app.bean.ShopMallGoodsBean;
import com.quktzhuanka.app.config.Constants;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

public class ShopMallGoodsRecyclerAdapter extends CommonAdapter<ShopMallGoodsBean> {
    Drawable drawable;

    public ShopMallGoodsRecyclerAdapter(Context context, int layoutId, List<ShopMallGoodsBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, ShopMallGoodsBean item, int position) {
        //设置图片
        ImageView imageView = holder.getView(R.id.image);
        Glide.with(mContext).load(Constants.APP_IP + item.img).dontAnimate().into(imageView);

        ((TextView) holder.getView(R.id.title_child)).setText(item.goods_name);
        holder.setText(R.id.tx2, "￥" + item.price);
        TextView tx2_2 = holder.getView(R.id.tx2_2);
        tx2_2.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        tx2_2.setText("");
        holder.setText(R.id.tx5, "销量:" + item.sales_volume);
        if ("15".equals(item.goods_id)) {
            holder.setText(R.id.txt_buy, "享一年高级权益");
        } else {
            holder.setText(R.id.txt_buy, "享终生高级权益");
        }
    }
}
